package com.bcn.login_mybatisplus_demo.schedule.service.impl;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import com.bcn.login_mybatisplus_demo.interceptor.AuthStorage;
import com.bcn.login_mybatisplus_demo.schedule.domain.TAppSchedule;
import com.bcn.login_mybatisplus_demo.schedule.mapper.TAppScheduleMapper;
import com.bcn.login_mybatisplus_demo.schedule.service.ITAppScheduleService;
import com.bcn.login_mybatisplus_demo.util.Convert;
import com.bcn.login_mybatisplus_demo.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 【请填写功能名称】Service业务层处理
 * 
 * @author administrator
 * @date 2025-03-18
 */
@Service
public class TAppScheduleServiceImpl implements ITAppScheduleService
{
    @Autowired
    private TAppScheduleMapper tAppScheduleMapper;

    /**
     * 查询【请填写功能名称】
     * 
     * @param id 【请填写功能名称】ID
     * @return 【请填写功能名称】
     */
    @Override
    public TAppSchedule selectTAppScheduleById(Long id)
    {
        return tAppScheduleMapper.selectTAppScheduleById(id);
    }

    /**
     * 查询【请填写功能名称】列表
     * 
     * @param tAppSchedule 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<TAppSchedule> selectTAppScheduleList(TAppSchedule tAppSchedule)
    {
        tAppSchedule.setUserId(AuthStorage.getUser().getId());
        return tAppScheduleMapper.selectTAppScheduleList(tAppSchedule);
    }

    /**
     * 新增【请填写功能名称】
     * 
     * @param tAppSchedule 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertTAppSchedule(TAppSchedule tAppSchedule)
    {
        Long id = AuthStorage.getUser().getId();
        tAppSchedule.setUserId(id);
        tAppSchedule.setCreateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
        return tAppScheduleMapper.insertTAppSchedule(tAppSchedule);
    }

    /**
     * 修改【请填写功能名称】
     * 
     * @param tAppSchedule 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateTAppSchedule(TAppSchedule tAppSchedule)
    {
        return tAppScheduleMapper.updateTAppSchedule(tAppSchedule);
    }

    /**
     * 删除【请填写功能名称】对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTAppScheduleByIds(String ids)
    {
        return tAppScheduleMapper.deleteTAppScheduleByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除【请填写功能名称】信息
     * 
     * @param id 【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteTAppScheduleById(Long id)
    {
        return tAppScheduleMapper.deleteTAppScheduleById(id);
    }
}
